package com.nurdrobotics;

/**
 *
 * @author hpadmin
 */
public class Deployment extends Manipulator {
    private double currentVelocity = 0;

    public Deployment(){
        // Switch deployed and retracted limit switches
        super(6, 5, 4);

        // really the retracted switch
        extendedSwitchEnabled = false;
    }

    // should be called on each cycle of operator control
    public void updateVelocity()
    {
        // set current velocity to zero if we are deploying and the limit switch
        // is depressed
        if(this.retractedSwitch.get() && currentVelocity < 0){
            currentVelocity = 0;
        }
        setVelocity(currentVelocity);
    }

    public void deploy(){
        //note: motor direction is reversed
        currentVelocity = -1.0;
    }
    
    public void retract(){
        //note: motor direction is reversed
        currentVelocity = 1.0;
    }

    public void stop(){
        currentVelocity = 0.0;
    }

    public boolean isRetracting(){
        return currentVelocity > 0;
    }

    public boolean isDeployed(){
        //really getting deployed switch
        return retractedSwitch.get();
    }
}
